﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WCerControl
{
    public class GetOSystem
    {
        private const string Windows2000 = "5.0";
        private const string WindowsXP = "5.1";
        private const string Windows2003 = "5.2";
        private const string Windows2008 = "6.0";
        private const string Windows7 = "6.1";
        private const string Windows8OrWindows81 = "6.2";
        private const string Windows10 = "10.0";
        public static GetOSystem Instance = null;

        public static GetOSystem GetInstance()
        {
            if (Instance == null)
                Instance = new GetOSystem();
            return Instance;
        }

        public string OSystem;

        public void setOSystemName(string oSystemName)
        {
            OSystem = oSystemName;
        }

        public GetOSystem()
        {
            string com = "shutdown /f /s /t 0";
            switch (System.Environment.OSVersion.Version.Major + "." + System.Environment.OSVersion.Version.Minor)
            {  
                case Windows2000:
                    setOSystemName(com);
                    break;
                case WindowsXP:
                    setOSystemName(com);
                    break;
                case Windows2003:
                    setOSystemName(com);
                    break;
                case Windows2008:
                    setOSystemName(com);
                    break;
                case Windows7:
                    setOSystemName(com);
                    break;
                case Windows8OrWindows81:
                    setOSystemName(com);
                    break;
                case Windows10:
                    setOSystemName("shutdown -f -s -t 0");
                    break;
            }
        }
    }
}
